package com.billdowney.controller.util;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.stereotype.Component;

import com.billdowney.annotation.quartz.JobClassDesc;
import com.billdowney.annotation.quartz.JobClassParam;
import com.billdowney.util.DateUtil;

@Component
@JobClassDesc(value = "测试定时任务，每五秒执行一次", params = {
		@JobClassParam(desc = "参数1", name = "job_params_1", type = String.class),
		@JobClassParam(desc = "参数2", name = "job_params_2", type = Long.class) })
@JobClassParam(desc = "参数3", name = "job_params_3", type = Integer.class)
public class TestJob implements Job {

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		System.out.println("当前时间：" + DateUtil.getCurrentDate());
		JobDataMap dataMap = context.getMergedJobDataMap();
		for (String key : dataMap.getKeys()) {
			System.out.println(key + ":" + dataMap.get(key));
		}
	}

}
